package com.cskaoyan.dbutills.resultset;

import com.cskaoyan.utils.DruidUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.ScalarHandler;

import java.sql.SQLException;

/**
 * 创建日期: 2022/10/11 15:52
 *
 * @author ciggar
 */
public class ScarlarHandlerDemo {

    public static void main(String[] args) throws SQLException {

        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());

        Long totalRows = queryRunner.query("select count(*) from city", new ScalarHandler<>());

        System.out.println(totalRows);
    }
}
